import {
  GetConsumablesManagementInfo,
  GetContractInfo,
  GetEvectionInfo,
  GetExpenseAccountInfo,
  GetInfoPicture,
  GetInvoicInfo,
  GetIssueReceiptInfo,
  GetLeaveInfo,
  GetMeetingLogInfo,
  GetMeetingRoomInfo,
  GetOrderManagementInfo,
  GetPaymentFunctionInfo,
  GetPreviewImage,
  GetProcureApplicationInfo,
  GetProcurementConfirmationInfo,
  GetProjectArchivingInfo,
  GetSealInfo,
  GetTapeoutPaymengtInfo,
  GetTopicInfo,
  GetUserInfoById,
  PostStatusChange
} from "../../../../constData/requestFun/_httpRequest";
import {
  GetUserInfoFiled
} from "../../../../constData/requestFun/_utils";
import isEmpty from 'loadsh/isEmpty'
import {
  ChipPaymentStatusChange,
  ConsumableManagementStatusChange,
  ContractManagementStatusChange,
  EvectionStatusChange,
  GetChipPayment,
  GetchipPaymentAccount,
  GetCnt,
  GetConsumableManagement,
  GetConsumableManagementById,
  GetContractManagement,
  GetContractManagementById,
  GetEvection,
  GetEvectionById,
  GetInvoicing,
  GetIssueReceipts,
  GetLeave,
  GetMeetingMinutes,
  GetOrder,
  GetOrderManagement,
  GetPayment,
  GetProcurementConfirmation,
  GetProjectManagement,
  GetPurchaseRequest,
  GetPurchaseRequestById,
  GetReimbursement,
  GetReimbursementById,
  GetSalaryInfo,
  GetTopic,
  GetTopicById,
  GetTopicContract,
  GetUserInfo,
  GetUseSeal,
  InvoicingStatusChange,
  IssueReceiptsStatusChange,
  LeaveStatusChange,
  MeetingMinutesStatusChange,
  OrderManagementStatusChange,
  OrderStatusChange,
  PaymentStatusChange,
  ProcurementConfirmationStatusChange,
  ProjectManagementStatusChange,
  PurchaseRequestStatusChange,
  PutPayment,
  ReimbursementStatusChange,
  SalaryInfoStatusChange,
  TopicContractStatusChange,
  TopicStatusChange,
  UseSealStatusChange
} from "/constData/requestFun/_teseRequest";
import compact from 'loadsh/compact'
import {
  CORPID
} from "/constData/requestFun/_globalData";
import {
  GetUserNameById,
  LOG
} from "/constData/_";
Page({
  data: {
    localCoperId: '',
    CorpId: '',
    LeaveInfo: [], //请假数据
    EvectionInfo: [], //出差数据
    PurchasedConfirmationInfo: [], //采购申请确认数据
    PurchasRequisitInfo: [], //采购申请数据
    SealInfo: [], //用印申请数据
    MeetronmInfo: [], //会议室申请数据
    ContractInfo: [], //合同管理
    TopicInfo: [], //议题申请
    MeetMinutesInfo: [], //会议纪要
    SalaryInfo: [], //薪资审批
    InvoicInfo: [], //开票数据
    IssueReceiptInfo: [], //开收据数据
    ExpenseAccountInfo: [], //报销数据
    PaymentFunctionInfo: [], //付款管理
    ProjectArchivingInfo: [], //项目管理
    TapoutBusinessInfo: [], //流片付款
    TapeoutIssuesContractsInfo: [], //流片议题和合同
    OrderManagementInfo: [], //订单管理
    ConsumablesManagementInfo: [], //耗材管理
    Cnt: [],
    showLeave: true,
    showEvection: true,
    showPurchasedConfirmation: true,
    showPurchasRequisit: true,
    showSeal: true,
    showMeetronm: true,
    showTopic: true,
    showContract: true,
    showMeetMinutes: true,
    showSalary: true,
    showInvoic: true,
    showIssueReceipt: true,
    showExpenseAccount: true,
    showPaymentFunction: true,
    showProjectArchiving: true,
    showTapoutBusiness: true,
    showTapeoutIssuesContracts: true,
    showOrderManagement: true,
    showConsumablesManagement: true,

    BasicApplication: [{
      text: '请假审核',
      value: 'LeaveInfo'
    },
    {
      text: '出差审核',
      value: 'EvectionInfo'
    },
    ],
    IntegratedAdministrationType: [{
      text: '采购申请',
      value: 'PurchasRequisitInfo'
    },
    {
      text: '采购确认',
      value: 'PurchasedConfirmationInfo'
    },
    {
      text: '用印申请',
      value: 'SealInfo'
    },
    {
      text: '议题申请',
      value: 'TopicInfo'
    },
    {
      text: '会议纪要',
      value: 'MeetMinutesInfo'
    },
    {
      text: '合同审批',
      value: 'ContractInfo'
    },
    {
      text: '薪资审批',
      value: 'SalaryInfo'
    },
    ],
    SelectedValue: '',
    FinancialManagementType: [{
      text: '开票申请',
      value: 'InvoicInfo'
    },
    {
      text: '开收据申请',
      value: 'IssueReceiptInfo'
    },
    {
      text: '报销申请',
      value: 'ExpenseAccountInfo'
    },
    {
      text: '付款申请',
      value: 'PaymentFunctionInfo'
    },
    ],

    ProjectManagementType: [{
      text: '项目管理',
      value: 'ProjectArchivingInfo'
    },],
    TapeOutPaymentsType: [{
      text: '流片付款',
      value: 'TapoutBusinessInfo'
    },
    {
      text: '流片议题和合同',
      value: 'TapeoutIssuesContractsInfo'
    },
    ],
    LaboratoryType: [
      {
        text: '订单审批',
        value: 'OrderManagementInfo'
      },
      {
        text: '耗材审批',
        value: 'ConsumablesManagementInfo'
      },
    ],
    FundingSources: [],
    FundingSource: '',
  },

  TapeLaboratoryChange(value, items, e) {
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'OrderManagementInfo') {
          //订单管理
          GetOrder((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  OrderManagementInfo: compact(res).reverse()
                })
              })
          })
        } else if (value === 'ConsumablesManagementInfo') {
          //耗材管理
          GetConsumableManagement((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.coperId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  ConsumablesManagementInfo: compact(res).reverse()
                })
              })
          })
        }
      }
    })
  },
  TapeOutPaymentsChange(value, items, e) {
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'TapoutBusinessInfo') {
          //流片
          GetChipPayment((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['displayProofPayment'] = JSON.parse(it.item1.proofPayment)
                  it.item1['displayContractOrder'] = JSON.parse(it.item1.contractOrder)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  TapoutBusinessInfo: compact(res).reverse()
                })
              })
          })
        } else if (value === 'TapeoutIssuesContractsInfo') {
          //流片议题合同
          GetTopicContract((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {

                  it.item1['displayAnnex'] = JSON.parse(it.item1.t_Annex)
                  it.item1['displayPicture_A'] = JSON.parse(it.item1.c_Picture_A)
                  it.item1['displayApprovalAnnex_A'] = JSON.parse(it.item1.c_ApprovalAnnex_A)
                  it.item1['displayPicture_B'] = JSON.parse(it.item1.c_Picture_B)
                  it.item1['displayApprovalAnnex_B'] = JSON.parse(it.item1.c_ApprovalAnnex_B)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.t_CorpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  TapeoutIssuesContractsInfo: compact(res).reverse()
                })
              })
          })
        }
      }
    })
  },
  ProjectManagementChange(value, items, e) {
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'ProjectArchivingInfo') {
          //项目管理
          GetProjectManagement((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['DisplayInitiation'] = JSON.parse(it.item1.initiationReport)
                  it.item1['DisplayAnnual'] = JSON.parse(it.item1.annualReport)
                  it.item1['DisplayClosing'] = JSON.parse(it.item1.closingReport)
                  it.item1['DisplayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  ProjectArchivingInfo: compact(res).reverse()
                })
              })
          })

        }
      }
    })
  },
  FinancialManagementChange(value, items, e) {
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'InvoicInfo') {
          //开票申请
          GetInvoicing((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetContractManagementById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                InvoicInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'IssueReceiptInfo') {
          //开收据申请
          GetIssueReceipts((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetContractManagementById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                IssueReceiptInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'ExpenseAccountInfo') {
          //报销申请
          GetReimbursement((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  it.item1['displayTempTrip'] = JSON.parse(it.item1.tempTrip)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetEvectionById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                ExpenseAccountInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'PaymentFunctionInfo') {
          //付款申请
          GetPayment((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                if (it.item1.associateOtherType === '关联合同') {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetContractManagementById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                }
                else {
                  return Promise.resolve(it);
                }
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                PaymentFunctionInfo: compact(DataRes).reverse()
              })
            })
          })
        }
      }
    })
  },
  FindingSourcesChange(value, e) {
    const id = e.currentTarget.dataset.id
    this.setData({
      FundingSource: value,
    })
  },
  onFindingSources(e) {
    const id = e.currentTarget.dataset.id
    const approval_id = e.currentTarget.dataset['approval-id']
    if (!isEmpty(this.data.FundingSource)) {
      PutPayment(id, this.data.FundingSource, (res) => {
        my.alert({
          content: '已提交'
        })
        this.setData({
          FundingSource: '',//提交后清楚数据
        })
      })
      PaymentStatusChange(approval_id, 1, '无', (res) => {
        GetPayment((res) => {
          Promise.all(
            res.data
              // 排空
              .filter(it => !isEmpty(it.item2))
              // 删除退回
              .filter(it => it.item2.approvalStatus !== 2)
              // 匹配审核人
              .filter(it => it.item2.approverId === this.data.CorpId)
              // 文件名称处理
              .map(it => {
                it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                return it
              })
              // 姓名处理
              .map(it => {
                return new Promise(resolve => {
                  GetUserInfo({
                    userId: it.item1.corpId,
                    fileds: null
                  }, (res) => {
                    it.item1.name = GetUserInfoFiled(res, 'name')
                    resolve(it)
                  })
                })
              }))
            // 渲染值到前端
            .then(res => {
              this.setData({
                PaymentFunctionInfo: compact(res).reverse()
              })
            })
        })
      })
    } else {
      my.alert({
        content: '暂无数据'
      })
    }

  },
  IntegratedAdministrationChange(value, items, e) {
    console.log('value', value);
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'PurchasRequisitInfo') {
          //采购申请
          GetPurchaseRequest((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  PurchasRequisitInfo: compact(res).reverse()
                })
              })
          })
        } else if (value === 'PurchasedConfirmationInfo') {
          //采购确认
          GetProcurementConfirmation((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetPurchaseRequestById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                PurchasedConfirmationInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'SealInfo') {
          //用印申请
          GetUseSeal((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  SealInfo: compact(res).reverse()
                })
              })
          })
        } else if (value === 'TopicInfo') {
          //议题申请
          new Promise(resolve => {
            GetTopic(res => resolve(res.data.map(it => {
              if (it.item1.corpId === storage.data.result.userid) {
                it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                return it
              }
            })))
          }).then(res => {
            return res
              .filter(it => it.item2 !== null && it.item2.length > 0)
              .map(it => {
                it.currentApprove = null
                it.item2.forEach(approval => {
                  if (approval.approvalStatus === 0 && it.currentApprove === null)
                    it.currentApprove = approval
                })
                return it
              })
              .filter(it => it.currentApprove !== null)
              .filter(it => it.currentApprove.approverId === storage.data.result.userid)
          }).then(res => {
            return res.map(it => {
              it.item3 = []
              it.item2.forEach(approval => {
                if (approval.approvalStatus >= 0) {
                  it.item3.push({
                    msg: approval.approveMsg,
                    approver: approval.approverId,
                    show: approval.approvalStatus !== 0
                  })
                }
              });
              return it
            })
          }).then(res => {
            const ids = []
            res.forEach(it => it.item3.forEach(i => {
              ids.push(i.approver)
            }))

            return Promise.all([
              Promise.resolve(res),
              ...ids.map(id => {
                return GetUserNameById(id)
              })
            ])
          }).then(res => {
            const data = res[0]
            const names = res.slice(1)

            return data.map(it => {
              it.item3.map(i3 => {
                names.forEach(name => {
                  if (name.id === i3.approver) {
                    i3.name = name.name
                  }
                })
                return i3
              })
              return it
            })
          }).then(res => {
            this.setData({
              TopicInfo: res.reverse()
            })
          })
        } else if (value === 'MeetMinutesInfo') {
          //会议纪要
          GetMeetingMinutes((res) => {
            Promise.all(
              res.data
                .filter(it => !isEmpty(it.item2))
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayMeetingAttachments'] = JSON.parse(it.item1.meetingAttachments)
                  it.item1['displayMeetingMinutes'] = JSON.parse(it.item1.meetingMinutes)
                  it.item1['displayTempTopic'] = JSON.parse(it.item1.tempTopic)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetTopicById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                MeetMinutesInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'ContractInfo') {
          //合同管理
          GetContractManagement((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                .filter(it => it.item2.approverId === this.data.CorpId)
                .map(it => {
                  it.item1['displayPicture'] = JSON.parse(it.item1.picture)
                  it.item1['displayApprovalAnnex'] = JSON.parse(it.item1.approvalAnnex)
                  return it
                })
                .map(it => {
                  return new Promise(r => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (userInfo) => {
                      it.item1.name = GetUserInfoFiled(userInfo, 'name')
                      r(it)
                    })
                  })
                })
            ).then(res => {
              const promises = res.map(it => {
                it.item3 = []
                return Promise.all(JSON.parse(it.item1.associateOtherId)
                  .map(id => {
                    return new Promise((resolve) => {
                      GetTopicById(id, (evectionRes) => {
                        it.item3.push(evectionRes.data.item1)
                        resolve(it);
                      });
                    });
                  })).then(() => it)
              })
              return Promise.all(promises);
            }).then(DataRes => {
              this.setData({
                ContractInfo: compact(DataRes).reverse()
              })
            })
          })
        } else if (value === 'SalaryInfo') {
          //薪资审批
          GetSalaryInfo((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  SalaryInfo: compact(res).reverse()
                })
              })
          })
        }
      }
    })
  },
  BasicApplicationChange(value, items, e) {
    this.setData({
      SelectedValue: value ? value : this.data.SelectedValue
    })
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (value === 'LeaveInfo') {
          //请假申请
          GetLeave((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  LeaveInfo: compact(res).reverse()
                })
              })
          })
        } else if (value === 'EvectionInfo') {
          //出差申请
          GetEvection((res) => {
            Promise.all(
              res.data
                // 排空
                .filter(it => !isEmpty(it.item2))
                // 删除退回
                .filter(it => it.item2.approvalStatus !== 2)
                // 匹配审核人
                .filter(it => it.item2.approverId === storage.data.result.userid)
                // 文件名称处理
                .map(it => {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  it.item1['displayAddJourney'] = JSON.parse(it.item1.addJourney)
                  return it
                })
                // 姓名处理
                .map(it => {
                  return new Promise(resolve => {
                    GetUserInfo({
                      userId: it.item1.corpId,
                      fileds: null
                    }, (res) => {
                      it.item1.name = GetUserInfoFiled(res, 'name')
                      resolve(it)
                    })
                  })
                }))
              // 渲染值到前端
              .then(res => {
                this.setData({
                  EvectionInfo: compact(res).reverse()
                })
              })
          })
        }
      }
    })
  },
  //议题发表
  Publish(e) {
    const id = e.target.dataset.id
    const ApproveId = e.target.dataset.approveid
    const Msg = e.target.dataset.msg;
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        //议题申请
        TopicStatusChange(ApproveId, 1, Msg, (res) => {
          my.alert({
            content: '已发表'
          })
          new Promise(resolve => {
            GetTopic(res => resolve(res.data.map(it => {
              if (it.item1.corpId === storage.data.result.userid) {
                it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                return it
              }
            })))
          }).then(res => {
            return res
              .filter(it => it.item2 !== null && it.item2.length > 0)
              .map(it => {
                it.currentApprove = null
                it.item2.forEach(approval => {
                  if (approval.approvalStatus === 0 && it.currentApprove === null)
                    it.currentApprove = approval
                })

                return it
              })
              .filter(it => it.currentApprove.approverId === storage.data.result.userid)

          }).then(res => {
            return res.map(it => {
              it.item3 = []
              it.item2.forEach(approval => {
                if (approval.approvalStatus >= 0) {
                  it.item3.push({
                    msg: approval.approveMsg,
                    approver: approval.approverId,
                    show: approval.approvalStatus !== 0
                  })
                }
              });
              return it
            })
          }).then(res => {
            const ids = []
            res.forEach(it => it.item3.forEach(i => {
              ids.push(i.approver)
            }))

            return Promise.all([
              Promise.resolve(res),
              ...ids.map(id => {
                return GetUserNameById(id)
              })
            ])
          }).then(res => {
            const data = res[0]
            const names = res.slice(1)

            return data.map(it => {
              it.item3.map(i3 => {
                names.forEach(name => {
                  if (name.id === i3.approver) {
                    i3.name = name.name
                  }
                })
                return i3
              })
              return it
            })
          }).then(res => {
            this.setData({
              TopicInfo: res.reverse()
            })
          })
        })
      }
    })
  },
  onCommentsChange(val, e) {
    const id = e.target.dataset.id
    this.setData({
      TopicInfo: this.data.TopicInfo.map(it => {
        if (it.item1.id === id) {
          it.item1.cacheCom = val
        }
        return it
      })
    })
  },

  show(e) {
    const item = e.target.dataset.item
    this.setData({
      [item]: !this.data[item]
    })
  },
  onLoad() {
    my.getStorage({
      key: 'userInfo',
      success: (res) => {
        const id = res.data.result.userid
        this.setData({
          CorpId: id
        })
      }
    })
    GetCnt((res) => {  
      // 当Cnt数据到达时，首先更新Cnt数据  
      this.setData({  
        Cnt: res.data  
      });  
      // let newBasicApplication = [...this.data.BasicApplication];  
      // newBasicApplication[0].text = `请假审核 ${this.data.Cnt.ELeave}`;  
      // newBasicApplication[1].text = `出差审核 ${this.data.Cnt.EBusinessTrip}`;  
      // let newIntegratedAdministrationType = [...this.data.IntegratedAdministrationType];  
      // newIntegratedAdministrationType[0].text = `采购申请 ${this.data.Cnt.EPurchaseRequest}`;  
      // newIntegratedAdministrationType[1].text = `采购确认 ${this.data.Cnt.EProcurementConfirmation}`;  
      // newIntegratedAdministrationType[2].text = `用印申请 ${this.data.Cnt.EUseSeal}`;  
      // newIntegratedAdministrationType[3].text = `议题申请 ${this.data.Cnt.ETopic}`;  
      // newIntegratedAdministrationType[4].text = `会议纪要 ${this.data.Cnt.EMeetingMinutes}`;  
      // newIntegratedAdministrationType[5].text = `合同审批 ${this.data.Cnt.EContractManagement}`;  
      // newIntegratedAdministrationType[6].text = `薪资审批 ${this.data.Cnt.ESalaryInfo}`;  
      // let newFinancialManagementType = [...this.data.FinancialManagementType];  
      // newFinancialManagementType[0].text = `开票申请 ${this.data.Cnt.EInvoicing}`;  
      // newFinancialManagementType[1].text = `收据申请 ${this.data.Cnt.EIssueReceipts}`;  
      // newFinancialManagementType[2].text = `报销申请 ${this.data.Cnt.EReimbursement}`;  
      // newFinancialManagementType[3].text = `付款申请 ${this.data.Cnt.EPayment}`;  
      // let newProjectManagementType= [...this.data.ProjectManagementType];  
      // newProjectManagementType[0].text = `项目管理 ${this.data.Cnt.EProjectManagement}`;  
      // let newTapeOutPaymentsType = [...this.data.TapeOutPaymentsType];  
      // newTapeOutPaymentsType[0].text = `流片付款 ${this.data.Cnt.EChipPayment}`;  
      // newTapeOutPaymentsType[1].text = `流片议题和合同 ${this.data.Cnt.ET_C}`;  
      // let newLaboratoryType= [...this.data.LaboratoryType];  
      // newLaboratoryType[0].text = `订单审批 ${this.data.Cnt.EOrder}`;  
      // newLaboratoryType[1].text = `耗材审批 ${this.data.Cnt.EConsumableManagement}`;  
      // this.setData({  
      //   BasicApplication: newBasicApplication,
      //   IntegratedAdministrationType:newIntegratedAdministrationType,
      //   FinancialManagementType:newFinancialManagementType,
      //   ProjectManagementType:newProjectManagementType,
      //   TapeOutPaymentsType:newTapeOutPaymentsType,
      //   LaboratoryType:newLaboratoryType,
      // });  
    });   
  },
  CheckPictures(e) {
    const item = e.currentTarget.dataset.item
    dd.previewFileInDingTalk({
      spaceId: item.spaceId,
      fileName: item.fileName,
      corpId: CORPID,
      fileSize: item.fileSize,
      fileType: item.fileType,
      fileId: item.fileId,
    });
  },
  //同意按钮
  Pass(e) {
    const id = e.target.dataset.id;
    const status = 1;
    const table = e.target.dataset.table;
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (table === 'Leave') {
          LeaveStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetLeave((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    LeaveInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'BusinessTrip') {
          //出差申请
          EvectionStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetEvection((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    it.item1['displayAddJourney'] = JSON.parse(it.item1.addJourney)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    EvectionInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ProcureApplication') {
          //采购申请
          PurchaseRequestStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetPurchaseRequest((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    PurchasRequisitInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ProcurementConfirmation') {
          //采购确认
          ProcurementConfirmationStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetProcurementConfirmation((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetPurchaseRequestById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  PurchasedConfirmationInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Seal') {
          //用印申请
          UseSealStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetUseSeal((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    SealInfo: compact(res).reverse()
                  })
                })
            })
          })
        }
        else if (table === 'MeetingLog') {
          //会议纪要
          MeetingMinutesStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetMeetingMinutes((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayMeetingAttachments'] = JSON.parse(it.item1.meetingAttachments)
                    it.item1['displayMeetingMinutes'] = JSON.parse(it.item1.meetingMinutes)
                    it.item1['displayTempTopic'] = JSON.parse(it.item1.tempTopic)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetTopicById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  MeetMinutesInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Contract') {
          //合同管理
          ContractManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetContractManagement((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayPicture'] = JSON.parse(it.item1.picture)
                    it.item1['displayApprovalAnnex'] = JSON.parse(it.item1.approvalAnnex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetTopicById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  ContractInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Salary') {
          //薪资审批
          SalaryInfoStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetSalaryInfo((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    SalaryInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'Invoicing') {
          //开票申请
          InvoicingStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetInvoicing((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetContractManagementById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  InvoicInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'IssueReceipts') {
          //开收据申请
          IssueReceiptsStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetIssueReceipts((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetContractManagementById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  IssueReceiptInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Reimbursement') {
          //报销申请
          ReimbursementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetReimbursement((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    it.item1['displayTempTrip'] = JSON.parse(it.item1.tempTrip)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetEvectionById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  ExpenseAccountInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Payment') {
          //付款申请
          PaymentStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetPayment((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  if (it.item1.associateOtherType === '合同') {
                    it.item3 = []
                    return Promise.all(JSON.parse(it.item1.associateOtherId)
                      .map(id => {
                        return new Promise((resolve) => {
                          GetContractManagementById(id, (evectionRes) => {
                            it.item3.push(evectionRes.data.item1)
                            resolve(it);
                          });
                        });
                      })).then(() => it)
                  } else {
                    return Promise.resolve(it);
                  }
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  PaymentFunctionInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'ProjectManagement') {
          //项目管理
          ProjectManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetProjectManagement((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['DisplayInitiation'] = JSON.parse(it.item1.initiationReport)
                    it.item1['DisplayAnnual'] = JSON.parse(it.item1.annualReport)
                    it.item1['DisplayClosing'] = JSON.parse(it.item1.closingReport)
                    it.item1['DisplayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    ProjectArchivingInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ChipPayment') {
          //流片管理
          ChipPaymentStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetChipPayment((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayProofPayment'] = JSON.parse(it.item1.proofPayment)
                    it.item1['displayContractOrder'] = JSON.parse(it.item1.contractOrder)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    TapoutBusinessInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'Topic_Contract') {
          //流片议题合同
          TopicContractStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetTopicContract((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.t_Annex)
                    it.item1['displayPicture_A'] = JSON.parse(it.item1.c_Picture_A)
                    it.item1['displayApprovalAnnex_A'] = JSON.parse(it.item1.c_ApprovalAnnex_A)
                    it.item1['displayPicture_B'] = JSON.parse(it.item1.c_Picture_B)
                    it.item1['displayApprovalAnnex_B'] = JSON.parse(it.item1.c_ApprovalAnnex_B)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.t_CorpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    TapeoutIssuesContractsInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'OrderManagement') {
          //订单管理
          OrderStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetOrder((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    OrderManagementInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ConsumablesManagement') {
          //耗材管理
          ConsumableManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已同意'
            })
            GetConsumableManagement((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.coperId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    ConsumablesManagementInfo: compact(res).reverse()
                  })
                })
            })
          })
        }
      }
    })
  },
  //拒绝按钮
  Back(e) {
    const id = e.target.dataset.id;
    const status = 2;
    const table = e.target.dataset.table;
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        if (table === 'Leave') {
          LeaveStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetLeave((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    LeaveInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'BusinessTrip') {
          //出差申请
          EvectionStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetEvection((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    it.item1['displayAddJourney'] = JSON.parse(it.item1.addJourney)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    EvectionInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ProcureApplication') {
          //采购申请
          PurchaseRequestStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetPurchaseRequest((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    PurchasRequisitInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ProcurementConfirmation') {
          //采购确认
          ProcurementConfirmationStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetProcurementConfirmation((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetPurchaseRequestById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  PurchasedConfirmationInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Seal') {
          //用印申请
          UseSealStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetUseSeal((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    SealInfo: compact(res).reverse()
                  })
                })
            })
          })
        }
        else if (table === 'MeetingLog') {
          //会议纪要
          MeetingMinutesStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetMeetingMinutes((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayMeetingAttachments'] = JSON.parse(it.item1.meetingAttachments)
                    it.item1['displayMeetingMinutes'] = JSON.parse(it.item1.meetingMinutes)
                    it.item1['displayTempTopic'] = JSON.parse(it.item1.tempTopic)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetTopicById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  MeetMinutesInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Contract') {
          //合同管理
          ContractManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetContractManagement((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayPicture'] = JSON.parse(it.item1.picture)
                    it.item1['displayApprovalAnnex'] = JSON.parse(it.item1.approvalAnnex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetTopicById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  ContractInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Salary') {
          //薪资审批
          SalaryInfoStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetSalaryInfo((res) => {
              const cacheData = res.data.filter(s => (!isEmpty(s.item2) && s.item2.approverId === storage.data.result.userid && s.item2.approvalStatus !== 2)).map(it => {
                if (it.item1.corpId === storage.data.result.userid) {
                  it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                  return it
                }
              })
              GetUserInfo({
                userId: storage.data.result.userid,
                fileds: null
              }, (result) => {
                this.setData({
                  SalaryInfo: compact(cacheData).map(d => {
                    if (d.item1.corpId === storage.data.result.userid) {
                      d.item1.name = GetUserInfoFiled(result, 'name')
                    }
                    return d
                  }).reverse()
                })
              })
            })
          })
        } else if (table === 'Invoicing') {
          //开票申请
          InvoicingStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetInvoicing((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetContractManagementById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  InvoicInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'IssueReceipts') {
          //开收据申请
          IssueReceiptsStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetIssueReceipts((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetContractManagementById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  IssueReceiptInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Reimbursement') {
          //报销申请
          ReimbursementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetReimbursement((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === this.data.CorpId)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    it.item1['displayTempTrip'] = JSON.parse(it.item1.tempTrip)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  it.item3 = []
                  return Promise.all(JSON.parse(it.item1.associateOtherId)
                    .map(id => {
                      return new Promise((resolve) => {
                        GetEvectionById(id, (evectionRes) => {
                          it.item3.push(evectionRes.data.item1)
                          resolve(it);
                        });
                      });
                    })).then(() => it)
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  ExpenseAccountInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'Payment') {
          //付款申请
          PaymentStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetPayment((res) => {
              Promise.all(
                res.data
                  .filter(it => !isEmpty(it.item2))
                  .filter(it => it.item2.approvalStatus === 0)
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  .map(it => {
                    return new Promise(r => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (userInfo) => {
                        it.item1.name = GetUserInfoFiled(userInfo, 'name')
                        r(it)
                      })
                    })
                  })
              ).then(res => {
                const promises = res.map(it => {
                  if (it.item1.associateOtherType === '关联合同') {
                    it.item3 = []
                    return Promise.all(JSON.parse(it.item1.associateOtherId)
                      .map(id => {
                        return new Promise((resolve) => {
                          GetContractManagementById(id, (evectionRes) => {
                            it.item3.push(evectionRes.data.item1)
                            resolve(it);
                          });
                        });
                      })).then(() => it)
                  } else {
                    return Promise.resolve(it);
                  }
                })
                return Promise.all(promises);
              }).then(DataRes => {
                this.setData({
                  PaymentFunctionInfo: compact(DataRes).reverse()
                })
              })
            })
          })
        } else if (table === 'ProjectManagement') {
          //项目管理
          ProjectManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetProjectManagement((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['DisplayInitiation'] = JSON.parse(it.item1.initiationReport)
                    it.item1['DisplayAnnual'] = JSON.parse(it.item1.annualReport)
                    it.item1['DisplayClosing'] = JSON.parse(it.item1.closingReport)
                    it.item1['DisplayAnnex'] = JSON.parse(it.item1.annex)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    ProjectArchivingInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ChipPayment') {
          //流片管理
          ChipPaymentStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetChipPayment((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayProofPayment'] = JSON.parse(it.item1.proofPayment)
                    it.item1['displayContractOrder'] = JSON.parse(it.item1.contractOrder)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    TapoutBusinessInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'Topic_Contract') {
          //流片议题合同
          TopicContractStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetTopicContract((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 文件名称处理
                  .map(it => {
                    it.item1['displayAnnex'] = JSON.parse(it.item1.t_Annex)
                    it.item1['displayPicture_A'] = JSON.parse(it.item1.c_Picture_A)
                    it.item1['displayApprovalAnnex_A'] = JSON.parse(it.item1.c_ApprovalAnnex_A)
                    it.item1['displayPicture_B'] = JSON.parse(it.item1.c_Picture_B)
                    it.item1['displayApprovalAnnex_B'] = JSON.parse(it.item1.c_ApprovalAnnex_B)
                    return it
                  })
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.t_CorpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    TapeoutIssuesContractsInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'OrderManagement') {
          //订单管理
          OrderStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetOrder((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.corpId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    OrderManagementInfo: compact(res).reverse()
                  })
                })
            })
          })
        } else if (table === 'ConsumablesManagement') {
          //耗材管理
          ConsumableManagementStatusChange(id, status, '无', (res) => {
            my.alert({
              content: '已拒绝'
            })
            GetConsumableManagement((res) => {
              Promise.all(
                res.data
                  // 排空
                  .filter(it => !isEmpty(it.item2))
                  // 删除退回
                  .filter(it => it.item2.approvalStatus === 0)
                  // 匹配审核人
                  .filter(it => it.item2.approverId === storage.data.result.userid)
                  // 姓名处理
                  .map(it => {
                    return new Promise(resolve => {
                      GetUserInfo({
                        userId: it.item1.coperId,
                        fileds: null
                      }, (res) => {
                        it.item1.name = GetUserInfoFiled(res, 'name')
                        resolve(it)
                      })
                    })
                  }))
                // 渲染值到前端
                .then(res => {
                  this.setData({
                    ConsumablesManagementInfo: compact(res).reverse()
                  })
                })
            })
          })
        }
      }
    })
  },
});